var form=layui.form;
var $=layui.jquery;
var layer=layui.layer;
var element=layui.element;
var laytpl=layui.laytpl;
var laypage=layui.laypage;
var upload=layui.upload;
var laydate=layui.laydate;
function formSubmit(url,submit,dataType,func){
	form.on(submit,function(data){
		ajax(url,data.field,dataType,func);
	})
}

function ajax(url,field,dataType,func){
	$.ajax({
		url:base.app+url,
		type:"post",
		data:field,
		dataType:dataType,
		success:func
	})
}
function openLayer(url,end){
	layer.open({
		type:2,
		area:['750px','500px'],
		fixed:false,
		maxmin:true,
		content:base.app+url,
		end:end
	});
}
function closeThis(){
	//当你在iframe页面关闭自身时
	var index = parent.layer.getFrameIndex(window.name); //先得到当前iframe层的索引
	parent.layer.close(index); //再执行关闭 
}
function openConfirm(func,title){
	layer.confirm(title?title:"确定进行该操作？",
			{icon:3,title:"提示"},func)
	
}
function getlaytpl(sel,data){
	return laytpl($(sel).html()).render(data);
}
function setPageInfo(elem,count,curr,limit,jump){
	laypage.render({
		elem:elem,
		count:count,
		curr:curr,
		limit:limit,
		limits:[10,20,30,40,50],
		layout:['count','prev','page','next','limit','refresh','skip'],
		jump:jump
		
	})
}
function renderUpload(id,url,data,done){
	upload.render({
		elem:"#"+id,
		url:base.app+url,
		data:data,
		done:done
	})
}
function renderDate(id,value) {
	laydate.render({
		elem: "#" + id,
		type: "date",
		value: value
	})
}